package com;

import java.io.*;

public class Test11 {
    public static void main(String[] args) throws Exception {
//        write();
        read();
    }

    public static void read() throws IOException, Exception {
        String path = "HomeWork15\\dir\\序列化1.txt";

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
        Object o = ois.readObject();
        ois.close();
        PassCode pc = (PassCode) o;
        System.out.println(pc);
    }

    public static void write() throws Exception {
        String path = "HomeWork15\\dir\\序列化1.txt";
        PassCode s1 = new PassCode("张三", "26310");
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path));
        oos.writeObject(s1);
        oos.close();
    }
}
